function serializeJSON(form = undefined) {
    let json = {};
    for (let i = 0; i < form.elements.length; i++) {
        if ('' !== form.elements[i].name) {
            json[form.elements[i].name] = form.elements[i].value;
        }
    }
    return json;
}

function utf8_to_b64(str) {
    return window.btoa(unescape(encodeURIComponent(str)));
}

function b64_to_utf8(str) {
    return decodeURIComponent(escape(window.atob(str)));
}

function xss(html) {
    return html.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}